package cn.hefan.web.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.hefan.service.Service;

public class wcServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setHeader("Access-Control-Allow-Methods", "GET,POST");
		String name = request.getParameter("name");
		String username = request.getParameter("username");
		String sex = request.getParameter("sex");
		String phone = request.getParameter("phone");
		String shenfen = request.getParameter("shenfen");
		String taskid = request.getParameter("taskid");
		name = new String(name.getBytes("ISO-8859-1"), "UTF-8");
		sex = new String(sex.getBytes("ISO-8859-1"), "UTF-8");
		shenfen = new String(shenfen.getBytes("ISO-8859-1"), "UTF-8");
		if(name!=null&&phone!=null&&shenfen!=null&&sex!=null) {
			Service.wctTask(username,name,phone,shenfen,sex,taskid);
		}
		
	}

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

}